package excel.server.main;

import java.io.FileInputStream;
import java.util.Properties;

public class Config {
    private int port;
    private int poolSize;
    private String tempDir;

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    public int getPoolSize() {
        return poolSize;
    }

    public void setPoolSize(int poolSize) {
        this.poolSize = poolSize;
    }

    public String getTempDir() {
        return tempDir;
    }

    public void setTempDir(String tempDir) {
        this.tempDir = tempDir;
    }

    public static Config getConfig() {
        Config config = new Config();
        Properties properties = new Properties();
        try {
            FileInputStream fis = new FileInputStream("ExcelServer.properties");
            properties.load(fis);
            fis.close();
        } catch (Exception ex) {

        }
        config.setPort(Integer.parseInt(properties.getProperty("port", "39235")));
        config.setPoolSize(Integer.parseInt(properties.getProperty("poolSize", "20")));
        config.setTempDir(properties.getProperty("tempDir",null));
        return config;
    }
}
